// myWorker.js
function fibonacci(n) {
  if (n <= 1) {
    return n;
  } else {
    return fibonacci(n - 1) + fibonacci(n - 2);
  }
}
 
// 接收主线程传递的数据并返回结果
self.onmessage = function(event) {
  var data = event.data;
  var result = fibonacci(data);
  self.postMessage(result);
};